Repository navigation
Migrate to modern Python tooling (uv, pyproject.toml, semantic-release) - #2423
salman2013 wants to merge 9 commits into
Conversation
|
Thanks for the pull request, @salman2013! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2423 +/- ##
==========================================
+ Coverage 95.46% 95.53% +0.06%
==========================================
Files 198 198
Lines 22842 22820 -22
Branches 1551 1549 -2
==========================================
- Hits 21807 21801 -6
+ Misses 780 765 -15
+ Partials 255 254 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
d6b467b to
5ae0ab5
Compare
|
Hi @salman2013, thank you for your contribution! Please let us know when it is ready for review. |
13c9e99 to
7d5e631
Compare
| readme = "README.rst" | ||
| license = "AGPL-3.0-only" | ||
| license-files = ["LICENSE"] | ||
| authors = [ |
There was a problem hiding this comment.
Same as acid-block#282: {name = "edX", email = "oscm@edx.org"} is the legacy convention. This migration effort has standardized on {name = "Open edX Project", email = "oscm@openedx.org"}, matching sample-plugin's actual current pyproject.toml.
There was a problem hiding this comment.
This one doesn't look addressed yet — pyproject.toml still has {name = "edX", email = "oscm@edx.org"}. Please update to {name = "Open edX Project", email = "oscm@openedx.org"} per the migration convention.
There was a problem hiding this comment.
Confirmed — pyproject.toml now has {name = "Open edX Project", email = "oscm@openedx.org"}. Thanks for the fix. Resolving.
|
Hi @salman2013, it looks like one of the coverage checks is failing here. Could you have a look? |
…ntic-release) - Migrate to src layout (src/openassessment/) - Adopt uv for dependency management with pyproject.toml - Add tox environments: docs, quality; update js env to django42 - Integrate python-semantic-release for automated versioning - Update release workflow with immutable releases strategy and bumped action versions - Fix i18n_tool, webpack, and eslint paths for src layout - Update author to Open edX Project convention - Add docs tox env with doc8, build, and twine checks - Switch coverage to source_pkgs; add pragma: no cover to __version__ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
030f813 to
199dc30
Compare
…tooling # Conflicts: # .github/workflows/ci.yml # .github/workflows/pypi-publish.yml # openassessment/__init__.py
The omit pattern 'openassessment/runtime_imports/*' no longer matches 'src/openassessment/runtime_imports/*' after the src layout migration. Use '*/runtime_imports/*' to match regardless of path prefix. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Change --cov target from 'openassessment' to 'src/openassessment' so pytest-cov finds the package after the src layout migration - Add 'build' to norecursedirs to prevent stale build artifacts from being collected by pytest - Remove */tests/*, */__pycache__/*, */settings.py from coverage omit to match original .coveragerc behaviour; omitting in-package test files (100% covered) was artificially lowering the project coverage % Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds lock entries for build, doc8, twine and their transitive dependencies introduced in the doc dependency group. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@itsjeyd All tests are green now. |
|
Thanks @salman2013. @openedx/axim-engineering Pinging you here since this repo is currently unmaintained. This PR got approval from a CC earlier (#2423 (review)) and has a green build. Could you please have a look and merge the changes if they look good to you as well? |
|
|
||
| [tool.setuptools.package-data] | ||
| # locale/ is a symlink to conf/locale/ — include the real path instead | ||
| # (setuptools cannot copy symlinked directories into the wheel) |
There was a problem hiding this comment.
python -m build --wheel fails on this branch:
error: can't copy 'src/openassessment/locale': doesn't exist or not a regular file
src/openassessment/locale is a git-tracked symlink to conf/locale, and setuptools-scm's file finder puts every git-tracked path into SOURCES.txt, so build_py tries to copy the symlink as a file. origin/master builds fine. PSR runs build_command before it commits or tags, so the first push to master after this merges fails there and no version publishes.
The comment here is wrong too. MANIFEST.in's recursive-include src/openassessment/locale *.mo does copy through the symlink: published 7.1.1 and a build off this branch both carry the same 77 .mo files under openassessment/locale/, so conf/locale/** only adds a second copy of them.
| [tool.setuptools.packages.find] | ||
| where = ["src"] | ||
| include = ["openassessment*"] | ||
| exclude = ["*.tests", "*.tests.*"] |
There was a problem hiding this comment.
Once the build is fixed the wheel is 957 files / 4,878,011 bytes, against 466 / 2,601,590 for PyPI 7.1.1. Nothing that shipped before is dropped. What is new is 154 duplicate locale files under openassessment/conf/locale/, 191 test and spec files including 101 fixtures under openassessment/xblock/test/data, and the sass sources, xblock/static/xml and the font-awesome fonts.
include-package-data defaults to true under pyproject.toml, and with setuptools-scm's file finder that means every git-tracked file under a package directory, so neither MANIFEST.in nor [tool.setuptools.package-data] bounds the wheel any more. Widening this exclude to cover *.test is not enough on its own; I tried it and the files still ship as package data of the parent package.
Get the wheel back to what 7.1.1 shipped.
| contents: read | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: |
There was a problem hiding this comment.
docs is in the tox envlist but not in this matrix, and it is red: tox -e docs stops at doc8 docs/ with 105 errors across 8 files. That env is the only place that runs python -m build --wheel and twine check, which is what would have caught the wheel not building.
Add docs to the matrix and fix the doc8 failures.
| @@ -0,0 +1,121 @@ | |||
| name: Semantic Release | |||
There was a problem hiding this comment.
.github/release_process.md still says to bump the version in openassessment/__init__.py and package.json and then hand-create a matching release tag. That path no longer exists, the Python version comes from git tags now, and semantic-release creates the tag. Update it here.
… extra files
Setuptools' include-package-data default of true, combined with
setuptools-scm's git-tracked-file finder, pulled every git-tracked path
under openassessment/ into the wheel: the bare src/openassessment/locale
symlink crashed `python -m build --wheel` ("can't copy ... doesn't exist
or not a regular file"), and test/spec packages, duplicate locale files,
sass sources, static/xml fixtures, and font-awesome fonts all shipped
alongside it.
Set include-package-data = false so package-data/exclude-package-data
fully control wheel contents again, replace the conf/locale/** package
data (which only duplicated the real locale files) with explicit
locale/**/*.po and *.mo globs matching MANIFEST.in, and extend the
packages.find exclude to also match singular "test" packages (some
subpackages use "test", others "tests"). Verified the resulting wheel
is file-list-identical to the published 7.1.1 release.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The docs tox env (doc8, wheel build + twine check, Sphinx build) was never wired into CI, so it had drifted to 105 doc8 violations - trailing whitespace and lines over the 79-char limit - across 7 rst files, plus a couple of RST list/indentation issues. Reflow the long prose lines and strip trailing whitespace without changing content, add docs to the CI matrix, and gitignore the generated docs/_build/ output so it doesn't get swept into local doc8 runs. Verified `tox -e docs` passes end-to-end. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Both release_process docs still described bumping the version by hand in openassessment/__init__.py and package.json, then manually tagging a GitHub release. That path no longer exists: python-semantic-release now reads Conventional Commits messages to pick the next version, tags it, and publishes it via .github/workflows/release.yml. Update both docs to describe that flow instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…tooling Keeps the legacy pip-tools requirements/*.txt, openassessment/__init__.py version string, and .github/workflows/pypi-publish.yml deleted, since they're superseded by uv.lock, setuptools-scm, and release.yml respectively. Resolves the ci.yml/tox.ini conflict by dropping the django42 tox env/CI matrix entry/pyproject.toml dependency group, matching upstream's openedx#2424 decision to only test Django 5.2 going forward, and switches the js tox env to the "test" dependency group now that django42 is gone. Upgrades edx-lint (6.1.0 -> 6.2.0) and djangorestframework (3.17.1 -> 3.18.1) in uv.lock to match the versions upstream's own requirements upgrade already validated and wrote pylintrc/test fixes against. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
| - create a corresponding release on GitHub: | ||
| https://github.com/openedx/edx-ora2/releases | ||
|
|
There was a problem hiding this comment.
| - create a corresponding release on GitHub: | |
| https://github.com/openedx/edx-ora2/releases |
The Semantic Release workflow creates the GitHub release now, so this step is not needed.
Summary
Test plan
🤖 Generated with Claude Code